extends Card


func play_on_release(card_view: CardView) -> void:
	var player = card_view.get_tree().get_first_node_in_group("player")
	var player_state: PlayerInBattleState = Globals.player_state
	var tween := card_view.create_tween()
	tween.tween_callback(Shake.state_play.bind(player, StateBar.STATE.TEMP_POWER, self.power, self.duration))
	tween.tween_callback(
			Shake.state_play.bind(player, StateBar.STATE.TEMP_MAX_HEALTH, self.max_health, self.duration)
		).set_delay(0.3)
	tween.tween_interval(0.51)
	await tween.finished
	player_state.clear_debuff()
	player_state.anger += self.anger
	player_state.set_temp_power(self.power, self.duration)
	player_state.set_temp_max_health(self.max_health, self.duration)
	player_state.heal(self.max_health)
	card_view.play_on_release_signal_finish.emit()
	


func get_desc() -> String:
	if desc_lab == "":
		return ""
	var text = (
		desc_lab
		% [
			self.power,
			self.anger,
			self.max_health,
			self.duration
		]
	)
	return text


func init_from_csv(introduce):
	super.init_from_csv(introduce)
	self.power = int(introduce[5])
	self.anger = int(introduce[6])
	self.max_health = int(introduce[7])
	self.duration = int(introduce[8])
